﻿#ifndef ROBOTWOKER_H
#define ROBOTWOKER_H

#include <QObject>
#include <Ice/Ice.h>
#include <Glacier2/Glacier2.h>
#include <IceStorm/IceStorm.h>
#include "mysessioncb.h"
#include "RobotDef0.h"

class RobotWoker : public QObject
{
    Q_OBJECT
public:
    explicit RobotWoker(QObject *parent = 0);

    std::string ToUtf8(QString string);
    void getPrx();

    Glacier2::SessionFactoryHelperPtr _factory;
    Glacier2::SessionHelperPtr _session;

    Robot::JsonPrx m_prxJson;
    Robot::MotorPrx m_prxMotor;
    Robot::AudioPrx m_prxAudio;
    Robot::ScreenExPrx m_prxScreenEx;
    Robot::ConfigPrx m_prxConfig;
    Robot::PubPrx m_prxPub;
    Robot::SessionPrx m_prxSession;
    Robot::LivePrx m_prxLive;
    Robot::ScriptPrx m_prxScript;

    MySessionCB *m_pMySessionCB;
public slots:
    //tts
    void slot_tts_play(QString strTTS);
    void slot_tts_params(QString strTTS,QString strSpeaker,int nSpeed,int nPitch);
    void slot_tts_play_file(QString strFilePath);
    void slot_tts_volume(int nVolume);
    void slot_tts_stop();
    void slot_tts_Playing();

    //media
    void slot_media_play(QString strFilePath);
    void slot_media_volume(int nVolume);
    void slot_media_stop();
    void slot_media_Playing();

    //asr
    void slot_asr_build(QString strBNF);
    void slot_asr_gramma(QString strName);
    void slot_asr_start(int nMaxDelayMs,bool bCmdMode);
    void slot_asr_stop();

    //enable
    void slot_head_enable(bool bHeadLR,bool bHeadUD);
    void slot_hand_r_enable(bool bHandRExpand,bool bHandRSwing);
    void slot_hand_l_enable(bool bHandLExpand,bool bHandLSwing);

    //init
    void slot_head_lr_init();
    void slot_head_ud_init();
    void slot_hand_r_expand_init();
    void slot_hand_l_expand_init();
    void slot_hand_r_swing_init();
    void slot_hand_l_swing_init();

    //motor
    void slot_head_lr(int nHeadLRAngel,int nHeadLRSpeed);
    void slot_head_ud(int nHeadUDAngel,int nHeadUDSpeed);
    void slot_hand_r_expand(int nHandRExpandAngel,int nHandRExpandSpeed);
    void slot_hand_l_expand(int nHandLExpandAngel,int nHandLExpandSpeed);
    void slot_hand_r_swing(int nHandRSwingAngel,int nHandRSwingSpeed);
    void slot_hand_l_swing(int nHandLSwingAngel,int nHandLSwingSpeed);
    void slot_wheel_run(int nWheelDistance,int nWheelSpeed);
    void slot_wheel_rotate(int nWheelAngel,int nWheelSpeed);
    void slot_wheel_run_diff(bool bLeft,int nLeftSpeed,bool bRight,int nRightSpeed);
    void slot_wheel_stop(bool bStop);

    //script
    void slot_script_play_path(QString strFilePath);
    void slot_script_play_content(QString strContent);
    void slot_script_play_stop();
    void slot_script_playing();

    //json
    void slot_json_load(QString strFilePath);
    void slot_json_key_name(QString strKeyName);
    void slot_json_class_name(QString strClassName);
    void slot_json_stop();
    void slot_json_auto_play();
    void slot_json_playing();
    void slot_json_list();

    //led
    void slot_led_head_eye(int nIndexF,int nIndexB);
    void slot_led_head_eye_2(int nDelay,bool bR,bool bG,bool bB);
    void slot_led_head_ear(int nDelay,bool bR,bool bG,bool bB);
    void slot_led_body(int nDelay,bool bR,bool bG,bool bB);
    void slot_led_touch_set(int nMode,int nColor,int nFreq);

    //avoid
    void slot_set_avoid(bool bAvoid);
    void slot_get_avoid();

    //config
    void slot_set_system_volume(int nVolume);
    void slot_get_system_volume();
    void slot_set_system_cmd(QString strCmd);

    void slot_notify(int state, const QString &content);
};

#endif // ROBOTWOKER_H
